{#分类页面#}
{{ header }}
{#<div class="category-top-img" style="background: url('catalog/view/theme/default/image/category_bg.jpg');">#}
    {#<img src="catalog/view/theme/default/image/category_bg.jpg" alt="">#}
    {#<div class="container">#}
        {#<h1>{{ heading_title }}</h1>#}
    {#</div>#}
{#</div>#}
<input type="hidden" value="{{ heading_title }}" id="thisCate">
<div id="product-category">
    <div class="containers">
        <ul class="breadcrumb" id="cateBreadcrumb">
            {% for breadcrumb in breadcrumbs %}
                <li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li>
            {% endfor %}
        </ul>
        <div id="content" class="col-sm-12" style="padding: 0;">
            <div class="category-left">
                <ul>
                    {{ menu }}
                </ul>
            </div>
            <ul class="category-goods product-list">
                {% if products %}
                    {% for product in products %}
                        <li>
                            <a href="{{ product.href }}">
                                <img src="{{ product.thumb }}" alt="{{ product.name }}">
                            </a>
                            <div class="product-info">
                                <a href="{{ product.href }}">
                                    <div class="product-name">劉濤同款托特鏤空子母包【第二件$400】</div>
                                </a>
                                <div class="product-price">
                                    <div class="new-price">NT$1,298</div>
                                    <div class="old-price">NT$3,894</div>
                                </div>
                            </div>
                        </li>
                    {% endfor %}
                {% endif %}
                {% if not categories and not products %}
                    <div class="cate-empty">{{ text_empty }}</div>
                    {#<div class="buttons">#}
                        {#<div class="cate-emty-btn"><a href="{{ continue }}"#}
                                                   {#class="btn btn-primary">{{ button_continue }}</a>#}
                        {#</div>#}
                    {#</div>#}
                {% endif %}
            </ul>
        </div>
    </div>
</div>
<script>
    window.onload = function(){
        $('.category-left').height($('.category-goods')[0].offsetHeight);
        selectCateInit();
        empty();
    };
    window.onscroll = function (e) {
        if($(window).scrollTop() <= 38){
            $('.category-left')[0].style.top = (83 - $(window).scrollTop()) + 'px';
        }
        if($(window).scrollTop() >= 38){
            $('.category-left')[0].style.top = (83 - 38) + 'px';
        }
        $('.category-left').height($('.category-goods')[0].offsetHeight - $(window).scrollTop() +38);
    }
    function selectCateInit() {
        for(var i = 0; i < $('.category-left ul li.left-menu-cate').length; i++){
            console.log($('.category-left ul li.left-menu-cate')[i].innerText);
            console.log(removeN($('.category-left ul li.left-menu-cate')[i].innerText));
            if(removeN($('.category-left ul li.left-menu-cate')[i].innerText) == $('#thisCate').val()){
                $($('.category-left ul li.left-menu-cate')[i]).addClass('selectCateInit').siblings().removeClass('selectCateInit');
                console.log(1);
            }
        }
    }
    function removeN(str){
        return str.replace(/[\r\n]/g, '');
    }
    // 计算没有分类的高度
    function empty() {
        $('cate-empty')
    }
</script>
{{ footer }}
